using UnityEngine;
using System.Collections;

public class LightBeat : MonoBehaviour {
	
	#region Attributes
	
	private float lightIntensity = 0;
	public float maxIntensity = 8;
	public float velocity = 1;
	private bool augmenting = false;
	#endregion
	
	#region Unity Methods
	
	void Start () {
	
	}
	
	
	void Update () {
		
		//Debug.Log (lightIntensity);
		
		if (augmenting)
		{
			if (lightIntensity >= maxIntensity)
				augmenting = false; 
			
			lightIntensity += velocity*Time.deltaTime;
		}
		
		else
		{
			if (lightIntensity <= 0)
				augmenting = true; 
			
			lightIntensity -= velocity*Time.deltaTime;
		}
		
		this.gameObject.light.intensity = lightIntensity;
	}
	#endregion
}
